home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / gui / shell.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  4KB  |  104 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from __future__ import with_statement
  5. import os
  6. import sys
  7. import wx
  8. import wx.py as py
  9. from util import traceguard
  10. from gui.toolbox import loadWindowPos, saveWindowPos
  11. __all__ = [
  12.     'PyCrustFrame']
  13.  
  14. class PyCrustFrame(wx.Frame):
  15.     
  16.     def __init__(self, parent = None, id_ = -1, title = 'Digsby Shell', standalone = False, name = 'Digsby Shell'):
  17.         wx.Frame.__init__(self, parent, id_)
  18.         self.SetTitle(self.ShellTitle)
  19.         self.Bind(wx.EVT_SHOW, self.on_show)
  20.         self.title_timer = (wx.PyTimer,)((lambda : self.SetTitle(self.ShellTitle)))
  21.         self.title_timer_interval = 500
  22.         
  23.         try:
  24.             import digsbyprofile as digsbyprofile
  25.             prefs = digsbyprofile.profile.prefs
  26.         except ImportError:
  27.             prefs = { }
  28.         except AttributeError:
  29.             prefs = { }
  30.  
  31.         py.editwindow.FACES['mono'] = prefs.get('debug.shell.font', 'Courier New')
  32.         if prefs.get('debug.shell.minimal', True):
  33.             crust = shell = py.shell.Shell(self)
  34.         else:
  35.             crust = py.crust.Crust(self, intro = 'Digsby Shell')
  36.             shell = crust.shell
  37.         wx.GetApp().shell_locals = shell.interp.locals
  38.         import common.commandline as common
  39.         shell.interp.locals.update(common.commandline.__dict__)
  40.         self.input = shell
  41.         if 'debug.shell.history.size' in prefs:
  42.             maxsize = prefs['debug.shell.history.size']
  43.             h = prefs['debug.shell.history.lines']
  44.             h = h[:maxsize]
  45.             prefs['debug.shell.history.lines'] = shell.history = h
  46.         
  47.         self.crust = crust
  48.         self.Bind(wx.EVT_CLOSE, self.on_close)
  49.         loadWindowPos(self)
  50.         self.standalone = standalone
  51.         traceguard.__enter__()
  52.         
  53.         try:
  54.             skin = skin
  55.             import gui
  56.             self.SetFrameIcon(skin.get('AppDefaults.TaskbarIcon').Inverted)
  57.         finally:
  58.             pass
  59.  
  60.  
  61.     
  62.     def FocusInput(self):
  63.         self.input.SetFocus()
  64.  
  65.     
  66.     def on_close(self, e = None):
  67.         if self.IsShown():
  68.             saveWindowPos(self)
  69.         
  70.         self.Show(False)
  71.         if self.standalone:
  72.             sys.exit()
  73.         
  74.  
  75.     
  76.     def on_show(self, shown):
  77.         shown.Skip()
  78.         if shown:
  79.             self.title_timer.Start(self.title_timer_interval, False)
  80.         else:
  81.             self.title_timer.Stop()
  82.  
  83.     if 'wxMSW' in wx.PlatformInfo:
  84.         
  85.         def ShellTitle(self):
  86.             return 'Digsby Shell -- %s -- (gdi: %s, user: %s) -- pid: %s' % (nicebytecount(memory_info().WorkingSetSize), count_gdi_objects(), count_user_objects(), os.getpid())
  87.  
  88.         ShellTitle = property(ShellTitle)
  89.     else:
  90.         ShellTitle = 'Digsby Shell'
  91.     
  92.     def toggle_shown(self):
  93.         if self.IsShown():
  94.             self.on_close()
  95.         else:
  96.             self.Show()
  97.  
  98.  
  99. if 'wxMSW' in wx.PlatformInfo:
  100.     from gui.native.win.process import memory_info, count_gdi_objects, count_user_objects
  101.     from util import nicebytecount
  102.     import gc
  103.  
  104.